<?php

namespace App\Http\Controllers\admin;

use App\Dao\AreaDao;
use App\Dao\UsersDao;
use App\Services\Code;
use App\Services\OssServices;

class UsersController extends BaseController
{
    public function users()
    {
        if(getIsHasPage()){
            return  Code::message('',200,UsersDao::users(request()->all()));
        }
        return view('admin.users.users');
    }


    public function recharge()
    {
        $params = request()->post();
        UsersDao::recharge($params);
        return Code::message('充值成功',200);
    }


    public function setShopLevel()
    {
        $params = request()->post();
        if(isPost()){
            UsersDao::setShopLevel($params);
            return Code::message('',200);
        }
        $info = UsersDao::getUserInfo(['user_id'=>$params['user_id']]);
        $areas = AreaDao::areasNoData(['level'=>1]);

        return view('admin.users.set_level',[
            'user_info'=>$info,
            'areas'=>$areas
        ]);
    }



}
